<template>
  <div class="login">
    <div class="login-from">
        <div class="login-img">
            <img src="../asstas/logo.png" alt="" />
        </div>
        <el-form ref="form">
            <el-form-item >
                <el-input v-model="user" placeholder="请输入用户名" prefix-icon="iconfont icon-user"></el-input>
            </el-form-item>
            <el-form-item>
                <el-input v-model="pwd" type='password' placeholder="请输入密码" prefix-icon="iconfont icon-3702mima"></el-input>
            </el-form-item>
            <el-form-item class="btns">
                <el-button type="primary" @click='login()'>登陆</el-button>
                <el-button type="info"  @click='chongzhi()'>重置</el-button>
            </el-form-item>
        </el-form>
    </div>
  </div>
</template>

<script>
export default {
    data() {
        return {
            user:'',
            pwd:''
        }
    },
    methods: {
        login:function(){
            var uPattern =/^[1-9]\d{4,12}/;
            var tst = uPattern.test(this.user)
            if(tst!==true){
                alert('用户名不对')
            }
        },
        chongzhi:function(){
            this.user=''
            this.pwd=''
        }
    },
}
</script>

<style lang="less" scoped>
.login {
  height: 100%;
  background-color: #2b4b6b;
  position: relative;
  .login-from {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 450px;
    height: 300px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255,255,255,.5);
    .login-img img {
      box-shadow: 0 0 10px rgba(255,255,255,.5);
      position: absolute;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 152px;
      height: 152px;
      border-radius: 50%;
      background-color: #fff;
      overflow: hidden;
      padding: 10px;
    }
    .el-form{
        width: 100%;
        position: absolute;
        bottom: 0;
        padding: 20px;
        .btns{
            text-align: right;
        }
    }
  }
}
</style>